package com.showsu.editor.entity.remote.moreapi;

import com.showsu.editor.utils.StringUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @Author: William
 * @Description: moreapi xhs作品详情接口的响应结果：https://apifox.com/apidoc/shared-0b55c993-4634-4f70-b6fc-3edf1c27344d/api-128538965
 * @Date: Created in 6:34 下午 2024/1/15
 * @Modified By:
 */
@Data
public class XhsAwemeDetailMoreApiResult implements Serializable {

    private Integer code;
    private String msg;
    private XhsAwemeDetailMoreApiData data;
    @Data
    public class XhsAwemeDetailMoreApiData implements Serializable {
        private String cursor_score;
        private String current_time;
        private Integer code;
        private String msg;
        private List<XhsAwemeDetailMoreApiDataItem> items;
    }
    @Data
    public class XhsAwemeDetailMoreApiDataItem implements Serializable {
        private String id;
        private String model_type;
        private Note note_card;
    }

    @Data
    public class Note implements Serializable {
        private String note_id;
        private String desc;
        /**
         * 标题
         */
        private String title;
        /**
         * 发布时间，10位时间戳
         */
        private Long time;
        /**
         * 最近更新时间，10位时间戳
         */
        private Long last_update_time;
        /**
         * 笔记类型，video-视频、normal-图文
         */
        private String type;
        /**
         * 该字段不为空，则代表是带货笔记
         */
        private String goodsId;

        private List<Image> image_list;

        private ShareInfo share_info;

        private User user;

        private InteractInfo interact_info;

        private String widgets_context;

        private List<Tag> tag_list;

        @Data
        public class Image implements Serializable {
            private String file_id;
            private Integer height;
            private Integer width;
            private String url;
            private String trace_id;
            private List<CoverInfo> info_list;
            private String url_pre;
            private String url_default;
            private Boolean live_photo;
            private Stream stream;

            @Data
            public class CoverInfo implements Serializable {
                private String image_scene;
                private String url;
            }

            @Data
            public class Stream implements Serializable {
                private List<H264> h264;

                @Data
                public class H264 implements Serializable {
                    private String master_url;
                    private List<String> backup_urls;
                }
            }
        }

        @Data
        public class ShareInfo implements Serializable {
            private Boolean un_share;
        }

        @Data
        public class User implements Serializable {
            private String nickname;
            private String avatar;
            private String user_id;
        }

        @Data
        public class InteractInfo implements Serializable {
            /**
             * 点赞量
             */
            private String liked_count;
            /**
             * 收藏量
             */
            private String collected_count;
            /**
             * 评论量
             */
            private String comment_count;
            /**
             * 分享量
             */
            private String share_count;

            private Boolean followed;
            private Boolean liked;
            private Boolean collected;
            private String relation;

            public Integer getLiked_count() {
                return StringUtil.changeFuzzyWriting2Number(liked_count);
            }

            public Integer getCollected_count() {
                return StringUtil.changeFuzzyWriting2Number(collected_count);
            }

            public Integer getComment_count() {
                return StringUtil.changeFuzzyWriting2Number(comment_count);
            }

            public Integer getShare_count() {
                return StringUtil.changeFuzzyWriting2Number(share_count);
            }
        }

        @Data
        public class Tag implements Serializable {
            private String id;
            private String name;
            private String type;
        }
    }
}
